#version 300 es

precision mediump float;
uniform sampler2D tex_y;
uniform sampler2D tex_u;
uniform sampler2D tex_v;
in vec2 v_texCoord;
out vec4 fragColor;

void main() {
    vec3 yuv;
    yuv.x = texture(tex_y,v_texCoord).r;
    yuv.y = texture(tex_u,v_texCoord).r- 0.5;
    yuv.z = texture(tex_v,v_texCoord).r- 0.5;

    vec3 rgb;

    rgb = mat3(1 , 1, 1,
                0, -0.3455, 1.779,
                1.4075, -0.7169, 0)*yuv;



    fragColor = vec4(rgb,1);
}

